home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat3p / fetchop.z / fetchop
Encoding:
Text File  |  2002-10-03  |  26.6 KB  |  397 lines

  1.  
  2.  
  3.  
  4. FFFFEEEETTTTCCCCHHHHOOOOPPPP((((3333PPPP))))                                                        FFFFEEEETTTTCCCCHHHHOOOOPPPP((((3333PPPP))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      atomic_alloc_res_ident, atomic_alloc_res_ident_addr,
  10.      atomic_alloc_reservoir, atomic_alloc_reservoir_addr,
  11.      atomic_alloc_var_ident, atomic_alloc_variable, atomic_set_perms,
  12.      atomic_free_variable, atomic_free_var_ident, atomic_free_reservoir,
  13.      atomic_store, atomic_store_and_or, atomic_store_and_and, atomic_load,
  14.      atomic_fetch_and_increment, atomic_fetch_and_decrement, atomic_clear -
  15.      atomic operations employing special fetchop hardware
  16.  
  17. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  18.      _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_ssss_yyyy_ssss_////_pppp_mmmm_oooo_...._hhhh_>>>>
  19.      _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_ffff_eeee_tttt_cccc_hhhh_oooo_pppp_...._hhhh_>>>>
  20.  
  21.      _aaaa_tttt_oooo_mmmm_iiii_cccc______rrrr_eeee_ssss______iiii_dddd_eeee_nnnn_tttt______tttt _aaaa_tttt_oooo_mmmm_iiii_cccc______aaaa_llll_llll_oooo_cccc______rrrr_eeee_ssss______iiii_dddd_eeee_nnnn_tttt_((((_ssss_iiii_zzzz_eeee______tttt _cccc_oooo_uuuu_nnnn_tttt_))))_;;;;
  22.  
  23.      _aaaa_tttt_oooo_mmmm_iiii_cccc______rrrr_eeee_ssss_eeee_rrrr_vvvv_oooo_iiii_rrrr______tttt _aaaa_tttt_oooo_mmmm_iiii_cccc______aaaa_llll_llll_oooo_cccc______rrrr_eeee_ssss_eeee_rrrr_vvvv_oooo_iiii_rrrr_((((_pppp_mmmm_oooo______hhhh_aaaa_nnnn_dddd_llll_eeee______tttt _pppp_oooo_llll_iiii_cccc_yyyy_,,,, _ssss_iiii_zzzz_eeee______tttt
  24.      _cccc_oooo_uuuu_nnnn_tttt_,,,, _aaaa_tttt_oooo_mmmm_iiii_cccc______rrrr_eeee_ssss______iiii_dddd_eeee_nnnn_tttt______tttt _rrrr_eeee_ssss______iiii_dddd_))))_;;;;
  25.  
  26.      _aaaa_tttt_oooo_mmmm_iiii_cccc______rrrr_eeee_ssss_eeee_rrrr_vvvv_oooo_iiii_rrrr______tttt _aaaa_tttt_oooo_mmmm_iiii_cccc______aaaa_llll_llll_oooo_cccc______rrrr_eeee_ssss_eeee_rrrr_vvvv_oooo_iiii_rrrr______aaaa_dddd_dddd_rrrr_((((_pppp_mmmm_oooo______hhhh_aaaa_nnnn_dddd_llll_eeee______tttt _pppp_oooo_llll_iiii_cccc_yyyy_,,,,
  27.      _ssss_iiii_zzzz_eeee______tttt _cccc_oooo_uuuu_nnnn_tttt_,,,, _aaaa_tttt_oooo_mmmm_iiii_cccc______rrrr_eeee_ssss______iiii_dddd_eeee_nnnn_tttt______tttt _rrrr_eeee_ssss______iiii_dddd_,,,, _vvvv_oooo_iiii_dddd _****_aaaa_dddd_dddd_rrrr_,,,, _uuuu_iiii_nnnn_tttt _ffff_llll_aaaa_gggg_ssss_))))_;;;;
  28.  
  29.      _aaaa_tttt_oooo_mmmm_iiii_cccc______vvvv_aaaa_rrrr______iiii_dddd_eeee_nnnn_tttt______tttt _aaaa_tttt_oooo_mmmm_iiii_cccc______aaaa_llll_llll_oooo_cccc______vvvv_aaaa_rrrr______iiii_dddd_eeee_nnnn_tttt_((((_aaaa_tttt_oooo_mmmm_iiii_cccc______rrrr_eeee_ssss_eeee_rrrr_vvvv_oooo_iiii_rrrr______tttt _rrrr_eeee_ssss_eeee_rrrr_vvvv_oooo_iiii_rrrr_))))_;;;;
  30.  
  31.      _aaaa_tttt_oooo_mmmm_iiii_cccc______vvvv_aaaa_rrrr______tttt _****_aaaa_tttt_oooo_mmmm_iiii_cccc______aaaa_llll_llll_oooo_cccc______vvvv_aaaa_rrrr_iiii_aaaa_bbbb_llll_eeee_((((_aaaa_tttt_oooo_mmmm_iiii_cccc______rrrr_eeee_ssss_eeee_rrrr_vvvv_oooo_iiii_rrrr______tttt _rrrr_eeee_ssss_eeee_rrrr_vvvv_oooo_iiii_rrrr_,,,,
  32.      _aaaa_tttt_oooo_mmmm_iiii_cccc______vvvv_aaaa_rrrr______iiii_dddd_eeee_nnnn_tttt______tttt_,,,, _vvvv_aaaa_rrrr______iiii_dddd_))))_;;;;
  33.  
  34.      _iiii_nnnn_tttt _aaaa_tttt_oooo_mmmm_iiii_cccc______ssss_eeee_tttt______pppp_eeee_rrrr_mmmm_ssss_((((_aaaa_tttt_oooo_mmmm_iiii_cccc______rrrr_eeee_ssss_eeee_rrrr_vvvv_oooo_iiii_rrrr______tttt _rrrr_eeee_ssss_eeee_rrrr_vvvv_oooo_iiii_rrrr_,,,, _aaaa_tttt_oooo_mmmm_iiii_cccc______pppp_eeee_rrrr_mmmm______tttt _pppp_eeee_rrrr_mmmm_ssss_))))_;;;;
  35.  
  36.      _vvvv_oooo_iiii_dddd _aaaa_tttt_oooo_mmmm_iiii_cccc______ffff_rrrr_eeee_eeee______vvvv_aaaa_rrrr_iiii_aaaa_bbbb_llll_eeee_((((_aaaa_tttt_oooo_mmmm_iiii_cccc______rrrr_eeee_ssss_eeee_rrrr_vvvv_oooo_iiii_rrrr______tttt _rrrr_eeee_ssss_eeee_rrrr_vvvv_oooo_iiii_rrrr_,,,, _aaaa_tttt_oooo_mmmm_iiii_cccc______vvvv_aaaa_rrrr______tttt _****
  37.      _vvvv_aaaa_rrrr_iiii_aaaa_bbbb_llll_eeee_))))_;;;;
  38.  
  39.      _vvvv_oooo_iiii_dddd _aaaa_tttt_oooo_mmmm_iiii_cccc______ffff_rrrr_eeee_eeee______vvvv_aaaa_rrrr______iiii_dddd_eeee_nnnn_tttt_((((_aaaa_tttt_oooo_mmmm_iiii_cccc______rrrr_eeee_ssss_eeee_rrrr_vvvv_oooo_iiii_rrrr______tttt _rrrr_eeee_ssss______iiii_dddd_,,,, _aaaa_tttt_oooo_mmmm_iiii_cccc______vvvv_aaaa_rrrr______iiii_dddd_eeee_nnnn_tttt______tttt
  40.      _vvvv_aaaa_rrrr______iiii_dddd_eeee_nnnn_tttt_))))_;;;;
  41.  
  42.      _vvvv_oooo_iiii_dddd _aaaa_tttt_oooo_mmmm_iiii_cccc______ffff_rrrr_eeee_eeee______rrrr_eeee_ssss_eeee_rrrr_vvvv_oooo_iiii_rrrr_((((_aaaa_tttt_oooo_mmmm_iiii_cccc______rrrr_eeee_ssss_eeee_rrrr_vvvv_oooo_iiii_rrrr______tttt _rrrr_eeee_ssss_eeee_rrrr_vvvv_oooo_iiii_rrrr_))))_;;;;
  43.  
  44.      _vvvv_oooo_iiii_dddd _aaaa_tttt_oooo_mmmm_iiii_cccc______ssss_tttt_oooo_rrrr_eeee_((((_aaaa_tttt_oooo_mmmm_iiii_cccc______vvvv_aaaa_rrrr______tttt _****_vvvv_aaaa_rrrr_,,,, _aaaa_tttt_oooo_mmmm_iiii_cccc______vvvv_aaaa_rrrr______tttt _vvvv_aaaa_llll_uuuu_eeee_))))_;;;;
  45.  
  46.      _vvvv_oooo_iiii_dddd _aaaa_tttt_oooo_mmmm_iiii_cccc______ssss_tttt_oooo_rrrr_eeee______aaaa_nnnn_dddd______oooo_rrrr_((((_aaaa_tttt_oooo_mmmm_iiii_cccc______vvvv_aaaa_rrrr______tttt _****_vvvv_aaaa_rrrr_,,,, _aaaa_tttt_oooo_mmmm_iiii_cccc______vvvv_aaaa_rrrr______tttt _vvvv_aaaa_llll_uuuu_eeee_))))_;;;;
  47.  
  48.      _vvvv_oooo_iiii_dddd _aaaa_tttt_oooo_mmmm_iiii_cccc______ssss_tttt_oooo_rrrr_eeee______aaaa_nnnn_dddd______aaaa_nnnn_dddd_((((_aaaa_tttt_oooo_mmmm_iiii_cccc______vvvv_aaaa_rrrr______tttt _****_vvvv_aaaa_rrrr_,,,, _aaaa_tttt_oooo_mmmm_iiii_cccc______vvvv_aaaa_rrrr______tttt _vvvv_aaaa_llll_uuuu_eeee_))))_;;;;
  49.  
  50.      _aaaa_tttt_oooo_mmmm_iiii_cccc______vvvv_aaaa_rrrr______tttt _aaaa_tttt_oooo_mmmm_iiii_cccc______llll_oooo_aaaa_dddd_((((_aaaa_tttt_oooo_mmmm_iiii_cccc______vvvv_aaaa_rrrr______tttt _****_vvvv_aaaa_rrrr_))))_;;;;
  51.  
  52.      _aaaa_tttt_oooo_mmmm_iiii_cccc______vvvv_aaaa_rrrr______tttt _aaaa_tttt_oooo_mmmm_iiii_cccc______ffff_eeee_tttt_cccc_hhhh______aaaa_nnnn_dddd______iiii_nnnn_cccc_rrrr_eeee_mmmm_eeee_nnnn_tttt_((((_aaaa_tttt_oooo_mmmm_iiii_cccc______vvvv_aaaa_rrrr______tttt _****_vvvv_aaaa_rrrr_))))_;;;;
  53.  
  54.      _aaaa_tttt_oooo_mmmm_iiii_cccc______vvvv_aaaa_rrrr______tttt _aaaa_tttt_oooo_mmmm_iiii_cccc______ffff_eeee_tttt_cccc_hhhh______aaaa_nnnn_dddd______dddd_eeee_cccc_rrrr_eeee_mmmm_eeee_nnnn_tttt_((((_aaaa_tttt_oooo_mmmm_iiii_cccc______vvvv_aaaa_rrrr______tttt _****_vvvv_aaaa_rrrr_))))_;;;;
  55.  
  56.      _aaaa_tttt_oooo_mmmm_iiii_cccc______vvvv_aaaa_rrrr______tttt _aaaa_tttt_oooo_mmmm_iiii_cccc______cccc_llll_eeee_aaaa_rrrr_((((_aaaa_tttt_oooo_mmmm_iiii_cccc______vvvv_aaaa_rrrr______tttt _****_vvvv_aaaa_rrrr_))))_;;;;
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. FFFFEEEETTTTCCCCHHHHOOOOPPPP((((3333PPPP))))                                                        FFFFEEEETTTTCCCCHHHHOOOOPPPP((((3333PPPP))))
  71.  
  72.  
  73.  
  74. AAAArrrrgggguuuummmmeeeennnnttttssss
  75.      _r_e_s__i_d    The handle used by unrelated processes to allocate a reservoir.
  76.                This is the value returned by _a_t_o_m_i_c__a_l_l_o_c__r_e_s__i_d_e_n_t().
  77.  
  78.      _p_o_l_i_c_y    The handle of a policy module created by the user.
  79.  
  80.      _c_o_u_n_t     The number of atomic variables that will be needed in a
  81.                reservoir.
  82.  
  83.      _a_d_d_r      The base address when choosing or getting information about the
  84.                base address where the variables are allocated.
  85.  
  86.      _f_l_a_g_s     The flags indicate whether to set or return the base address of
  87.                the variables.
  88.  
  89.      _r_e_s_e_r_v_o_i_r The handle for a reservoir from which variables can be
  90.                allocated.  This is the value return by
  91.                _a_t_o_m_i_c__a_l_l_o_c__r_e_s_e_r_v_o_i_r().
  92.  
  93.      _v_a_r__i_d    The handle used by unrelated processes to allocate a variable.
  94.                This is the value returned by _a_t_o_m_i_c__a_l_l_o_c__v_a_r__i_d_e_n_t().
  95.  
  96.      _v_a_r       The handle for an atomic variable returned by
  97.                _a_t_o_m_i_c__a_l_l_o_c__v_a_r_i_a_b_l_e().
  98.  
  99.      _v_a_l_u_e     A value to be stored, ORed, or ANDed against.
  100.  
  101.  
  102. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  103.      The primary function of the fetchop library (libfetchop) is to provide
  104.      atomic operations on memory.  If two processors attempt to simultaneously
  105.      modify a piece of memory, this library, via hardware, will ensure that
  106.      the operations are serialized.  These operation can be used to eliminate
  107.      race conditions when two processors desire to increment a variable.  The
  108.      atomic functions are performed using the hardware available on the system
  109.      on which the program is run.  For the Origin series (Origin 200 and 2000)
  110.      this means invoking the special fetchop hardware support for operations
  111.      on uncached memory.  When special support is lacking, as on other
  112.      platforms, the operations are performed using the load-linked, store-
  113.      conditional instruction sequence of the MIPS instruction set.  The
  114.      fetchop library (libfetchop.so) allows these atomic operations to be
  115.      performed both on memory shared in an address space as well as memory
  116.      across address spaces.  The setup for these two cases varies but the
  117.      actual calls to the atomic operations on the variables remain the same.
  118.  
  119.      To initialize the fetchop library for processes that will share an
  120.      address space (such as sproc'ed processes), a call to
  121.      _a_t_o_m_i_c__a_l_l_o_c__r_e_s_e_r_v_o_i_r() should be made.  A NULL value should be given
  122.      for the res_id.  The function will return a handle to a reservoir that
  123.      can be used to allocate variables.  A call to _a_t_o_m_i_c__a_l_l_o_c__v_a_r_i_a_b_l_e()
  124.      (with NULL for _v_a_r__i_d) should be made for each variable desired.  Before
  125.      exiting the program should call _a_t_o_m_i_c__f_r_e_e__v_a_r_i_a_b_l_e() for each variable
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. FFFFEEEETTTTCCCCHHHHOOOOPPPP((((3333PPPP))))                                                        FFFFEEEETTTTCCCCHHHHOOOOPPPP((((3333PPPP))))
  137.  
  138.  
  139.  
  140.      used and _a_t_o_m_i_c__f_r_e_e__r_e_s_e_r_v_o_i_r() once.
  141.  
  142.      The fetchop library has the ability to allow programs not sharing the
  143.      same address space to perform atomic operations on the same memory.  The
  144.      setup requires an extra step for both the reservoir and variable.  The
  145.      first call that should be made is _a_t_o_m_i_c__a_l_l_o_c__r_e_s__i_d_e_n_t().  This call
  146.      should be made once and only once.  This call return a unique global
  147.      identifier that all processes can use when calling
  148.      atomic_alloc_reservoir() using the identifier returned by
  149.      _a_t_o_m_i_c__a_l_l_o_c__r_e_s__i_d_e_n_t() as the value for _r_e_s__i_d.  A similar set of steps
  150.      is followed for atomic_alloc_var_ident() and _a_t_o_m_i_c__a_l_l_o_c__v_a_r_i_a_b_l_e().
  151.      For convenience, there is no reason why one process can't make all the
  152.      calls to both alloc_res_ident and alloc_var_ident and then pass all the
  153.      information (the res_id and each var_id) to its peers in one message.
  154.      Before exiting the program should call _a_t_o_m_i_c__f_r_e_e__v_a_r__i_d_e_n_t() and
  155.      _a_t_o_m_i_c__f_r_e_e__v_a_r_i_a_b_l_e() for each variable used and _a_t_o_m_i_c__f_r_e_e__r_e_s_e_r_v_o_i_r()
  156.      once.
  157.  
  158.      NOTE: In the case where processes don't share an address space, the
  159.      fetchop library makes use of shared memory so it is important that the
  160.      free calls are executed.  If they fail to be executed either because they
  161.      are not in the program or the program exits prematurely, the shared
  162.      memory segments can, and should be cleaned up "by hand" by using the
  163.      ipcrm(1) command.
  164.  
  165.      NOTE: The space allocated for the fetchop space is pinned down in memory
  166.      and as such the user should allocate only the numbers of variables they
  167.      plan to use.
  168.  
  169.  
  170.    EEEExxxxaaaammmmpppplllleeeessss
  171.      Example for processes sharing address space:
  172.  
  173.      atomic_reservoir = atomic_alloc_reservoir(USE_DEFAULT_PM,10, NULL);
  174.  
  175.      atomic_var = atomic_alloc_variable(atomic_reservoir, NULL);
  176.  
  177.      loop over work
  178.        atomic_fetch_and_increment(atomic_var);
  179.  
  180.      ret_inc = atomic_load(atomic_var);
  181.  
  182.      printf("finishing value of atomic var %lld", ret_inc);
  183.  
  184.      atomic_free_reservoir(atomic_reservoir);
  185.  
  186.  
  187.  
  188.      Example for processes across address spaces:
  189.  
  190.  
  191.      atomic_res_ident = atomic_alloc_res_ident(10);
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. FFFFEEEETTTTCCCCHHHHOOOOPPPP((((3333PPPP))))                                                        FFFFEEEETTTTCCCCHHHHOOOOPPPP((((3333PPPP))))
  203.  
  204.  
  205.  
  206.      atomic_reservoir = atomic_alloc_reservoir(USE_DEFAULT_PM,10,
  207.      atomic_res_ident);
  208.  
  209.      atomic_var_ident = atomic_alloc_var_ident(atomic_reservoir);
  210.  
  211.      atomic_var = atomic_alloc_variable(atomic_reservoir, atomic_var_ident);
  212.  
  213.      loop over work
  214.        atomic_fetch_and_increment(atomic_var);
  215.  
  216.      ret_inc = atomic_load(atomic_var);
  217.  
  218.      printf("finishing value of atomic var %lld", ret_inc);
  219.  
  220.      atomic_free_reservoir(atomic_reservoir);
  221.  
  222.  
  223.    RRRReeeessssoooouuuurrrrcccceeee AAAAllllllllooooccccaaaattttiiiioooonnnn
  224.      _aaaa_tttt_oooo_mmmm_iiii_cccc______aaaa_llll_llll_oooo_cccc______rrrr_eeee_ssss______iiii_dddd_eeee_nnnn_tttt_((((_)))) Establishes a system-wide unique reservoir id
  225.      that can be used by unrelated processes (not in the same address space)
  226.      to allocate a reservoir out of which they can obtain variables.  _c_o_u_n_t
  227.      indicates the number of variables the user will wish to use.
  228.  
  229.      _aaaa_tttt_oooo_mmmm_iiii_cccc______aaaa_llll_llll_oooo_cccc______rrrr_eeee_ssss_eeee_rrrr_vvvv_oooo_iiii_rrrr_((((_)))) Initializes a atomic variable reservoir sized to
  230.      hold a _c_o_u_n_t variables.  In systems with special hardware for atomic
  231.      operations, the reservoir may be allocated in a special region of memory.
  232.      When hardware support is not provided, the reservoir is allocated in the
  233.      process heap.  In either case the memory is pinned down so care should be
  234.      taken to allocate only the number of variables that are going to be used.
  235.      If NULL is passed for the _r_e_s__i_d, the memory will be mapped from
  236.      /dev/zero.  If something other than NULL is passed in as the res_ident,
  237.      then the memory is allocated from shared memory (see shmget(2)).  Care
  238.      should be taken to call _a_t_o_m_i_c__f_r_e_e__r_e_s_e_r_v_o_i_r upon exiting.  If a program
  239.      exits prematurely then the shared memory can be removed by hand with
  240.      _i_p_c_r_m(1).
  241.  
  242.      The policy module specified in _p_o_l_i_c_y is used to indicate where to place
  243.      the atomic variables, if users care about the locality of the variables
  244.      on a Non-Uniform Memory Access (NUMA) platforms.  If no particular policy
  245.      module is required, pass the constant USE_DEFAULT_PM.  The system will
  246.      allocate the atomic variables using the default policy for the user
  247.      process.
  248.  
  249.      The handle of the reservoir is returned if the function is successful.
  250.      This handle is used to allocate variables.  NULL is returned if a
  251.      reservoir could not be allocated.
  252.  
  253.      _aaaa_tttt_oooo_mmmm_iiii_cccc______aaaa_llll_llll_oooo_cccc______rrrr_eeee_ssss_eeee_rrrr_vvvv_oooo_iiii_rrrr______aaaa_dddd_dddd_rrrr_((((_)))) Similar to _a_t_o_m_i_c__a_l_l_o_c__r_e_s_e_r_v_o_i_r() except
  254.      that it is possible either to set or to get the address of the base
  255.      address of the variables.  If ATOMIC_GET_VADDR is passed in for the
  256.      _f_l_a_g_s, the _v_a_d_d_r will have the value where the variables were placed.  If
  257.      ATOMIC_SET_VADDR is passed in for the _f_l_a_g_s, then _v_a_d_d_r is taken as the
  258.  
  259.  
  260.  
  261.                                                                         PPPPaaaaggggeeee 4444
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. FFFFEEEETTTTCCCCHHHHOOOOPPPP((((3333PPPP))))                                                        FFFFEEEETTTTCCCCHHHHOOOOPPPP((((3333PPPP))))
  269.  
  270.  
  271.  
  272.      location where the library is supposed to place the variables.  A failure
  273.      to place the base of the variables at this location is considered a
  274.      failure, and NULL is returned.
  275.  
  276.      _aaaa_tttt_oooo_mmmm_iiii_cccc______aaaa_llll_llll_oooo_cccc______vvvv_aaaa_rrrr______iiii_dddd_eeee_nnnn_tttt_((((_)))) Establishes a system-wide unique variable id for
  277.      this _r_e_s_e_r_v_o_i_r that can be used by unrelated processes (not in the same
  278.      address space) to allocate a variable with the guarantee that each will
  279.      obtain access to the same memory.  Upon success the identifier is
  280.      returned else NULL is returned.
  281.  
  282.      _aaaa_tttt_oooo_mmmm_iiii_cccc______aaaa_llll_llll_oooo_cccc______vvvv_aaaa_rrrr_iiii_aaaa_bbbb_llll_eeee_((((_)))) Allocates a variable from the given reservoir.
  283.      If all processes are within one address space, the var_id can be NULL
  284.      otherwise the value returned by _a_t_o_m_i_c__a_l_l_o_c__v_a_r__i_d_e_n_t() should be used.
  285.      Upon success a handle to the the variable is returned else NULL is
  286.      returned.
  287.  
  288.      _aaaa_tttt_oooo_mmmm_iiii_cccc______ssss_eeee_tttt______pppp_eeee_rrrr_mmmm_ssss_((((_)))) Meaningful only in the case when
  289.      _a_t_o_m_i_c__a_l_l_o_c__v_a_r__i_d_e_n_t() has been called to establish mapping between
  290.      unrelated processes.  This call allows the mapping to also occur between
  291.      programs running under different userids.  Upon success 0 is returned,
  292.      else -1 is returned with errno set.
  293.  
  294.      _aaaa_tttt_oooo_mmmm_iiii_cccc______ffff_rrrr_eeee_eeee______vvvv_aaaa_rrrr_iiii_aaaa_bbbb_llll_eeee_((((_)))) Frees an atomic variable so that it can be reused.
  295.  
  296.      _aaaa_tttt_oooo_mmmm_iiii_cccc______ffff_rrrr_eeee_eeee______vvvv_aaaa_rrrr______iiii_dddd_eeee_nnnn_tttt_((((_)))) Used only in when processes are sharing address
  297.      space.  Frees the variable identifier so that it can be re-used to
  298.      allocate another variable.
  299.  
  300.      _aaaa_tttt_oooo_mmmm_iiii_cccc______ffff_rrrr_eeee_eeee______rrrr_eeee_ssss_eeee_rrrr_vvvv_oooo_iiii_rrrr_((((_)))) Frees the atomic reservoir.  It is especially
  301.      important that this is called in programs using fetchop across address
  302.      spaces.  If the program fails to call _a_t_o_m_i_c__f_r_e_e__r_e_s_e_r_v_o_i_r() either
  303.      because the code was not in the program or the program exits prematurely,
  304.      the shared memory segments can, and should be cleaned up "by hand" by
  305.      using the _i_p_c_r_m(1) command.
  306.  
  307.  
  308.    AAAAttttoooommmmiiiicccc OOOOppppeeeerrrraaaattttiiiioooonnnnssss
  309.      _aaaa_tttt_oooo_mmmm_iiii_cccc______ssss_tttt_oooo_rrrr_eeee_((((_)))) Stores _v_a_l_u_e in the memory addressed by var.
  310.  
  311.      _aaaa_tttt_oooo_mmmm_iiii_cccc______ssss_tttt_oooo_rrrr_eeee______aaaa_nnnn_dddd______oooo_rrrr_((((_)))) _v_a_l_u_e is bit-wise ORed with the data address by
  312.      var.
  313.  
  314.      _aaaa_tttt_oooo_mmmm_iiii_cccc______ssss_tttt_oooo_rrrr_eeee______aaaa_nnnn_dddd______aaaa_nnnn_dddd_((((_)))) _v_a_l_u_e is bit-wise ANDed with the data address by
  315.      var.
  316.  
  317.      _aaaa_tttt_oooo_mmmm_iiii_cccc______llll_oooo_aaaa_dddd_((((_)))) The value of the memory addressed by _v_a_r is returned.
  318.  
  319.      _aaaa_tttt_oooo_mmmm_iiii_cccc______ffff_eeee_tttt_cccc_hhhh______aaaa_nnnn_dddd______iiii_nnnn_cccc_rrrr_eeee_mmmm_eeee_nnnn_tttt_((((_)))) The memory addressed by _v_a_r is incremented
  320.      by 1 and the previous value is returned.
  321.  
  322.      _aaaa_tttt_oooo_mmmm_iiii_cccc______ffff_eeee_tttt_cccc_hhhh______aaaa_nnnn_dddd______dddd_eeee_cccc_rrrr_eeee_mmmm_eeee_nnnn_tttt_((((_)))) The memory addressed by _v_a_r is decremented
  323.      by 1 and the previous value is returned.
  324.  
  325.  
  326.  
  327.                                                                         PPPPaaaaggggeeee 5555
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334. FFFFEEEETTTTCCCCHHHHOOOOPPPP((((3333PPPP))))                                                        FFFFEEEETTTTCCCCHHHHOOOOPPPP((((3333PPPP))))
  335.  
  336.  
  337.  
  338.      _aaaa_tttt_oooo_mmmm_iiii_cccc______cccc_llll_eeee_aaaa_rrrr_((((_)))) The memory addressed bye _v_a_r is set to 0.
  339.  
  340.  
  341. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  342.      sproc(2), test_and_set(3p), barrier(3p), ipcs(1), ipcrm(1)
  343.  
  344.  
  345.  
  346.  
  347.  
  348.  
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.  
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.                                                                         PPPPaaaaggggeeee 6666
  394.  
  395.  
  396.  
  397.